package org.example.mytest.newMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.example.mytest.newentity.inventorylogs;
import org.example.mytest.newentity.users;
import org.example.mytest.newentity.warehouse;

import java.util.List;

@Mapper
public interface InventorylogsMapper extends BaseMapper<inventorylogs> {

    @Select("SELECT i.LogID, i.UserID, i.Quantity, i.goods, i.LogDate, i.ActionType " +
            "FROM inventorylogs i")
    @Results({
            @Result(property = "warehouseid", column = "WarehouseID"),
            @Result(property = "location", column = "Location"),
            @Result(property = "userid", column = "UserID"),
            @Result(column = "userid", property = "users", javaType = users.class,
                    one = @One(select = "org.example.mytest.newMapper.UsersMapper.findby"))
    })
    List<inventorylogs> getinvenAndUsers();
}
